package com.congee02.template;

public class AllSubSeqs {

    public static void process(char[] str, int i) {
        if (i == str.length) {
            StringBuilder stringBuilder = new StringBuilder();
            for (char c : str) {
                if (c != 0) {
                    stringBuilder.append(c);
                }
            }
            System.out.println(stringBuilder);
            return;
        }
        process(str, i + 1);
        char tmp = str[i];
        str[i] = 0;
        process(str, i + 1);
        str[i] = tmp;
    }

    public static void allSubSeqs(String s) {
        process(s.toCharArray(), 0);
    }

    public static void main(String[] args) {
        allSubSeqs("abcde");
    }

}
